package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.cameraMonitoringVO.CameraMonitoringAddDTO;
import com.bf.electroplating.pojo.vo.cameraMonitoringVO.CameraMonitoringDetailDTO;
import com.bf.electroplating.pojo.vo.cameraMonitoringVO.CameraMonitoringQueryDTO;
import com.bf.electroplating.pojo.vo.cameraMonitoringVO.CameraMonitoringUpdateDTO;
import com.bf.electroplating.pojo.vo.cameraMonitoringVO.CameraMonitoringVO;
import com.bf.electroplating.service.ICameraMonitoringService;
import com.bf.electroplating.util.idempotent.Idempotent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 摄像头管理表 前端控制器
 * </p>
 *
 * @author gzd
 * @since 2025-11-19
 */
@Tag(name = "摄像头管理表")
@RestController
@RequestMapping("/electroplating/cameraMonitoring")
public class CameraMonitoringController {

    @Resource
    private ICameraMonitoringService cameraMonitoringService;

    @PostMapping("/pageList")
    @Operation(summary = "分页查询摄像头管理列表", description = "分页查询摄像头管理列表")
    public ResultVO<Page<CameraMonitoringVO>> pageList(@RequestBody CameraMonitoringQueryDTO queryDTO) {
        return cameraMonitoringService.pageList(queryDTO);
    }

    @PostMapping("/detail")
    @Operation(summary = "获取摄像头管理详情", description = "获取摄像头管理详情")
    public ResultVO<CameraMonitoringVO> getDetail(@RequestBody CameraMonitoringDetailDTO idDTO) {
        return cameraMonitoringService.getDetail(idDTO);
    }

    @Idempotent
    @PostMapping("/save")
    @Operation(summary = "新增摄像头管理", description = "新增摄像头管理")
    public ResultVO<String> save(@RequestBody @Validated CameraMonitoringAddDTO dto) {
        return cameraMonitoringService.save(dto);
    }

    @PostMapping("/update")
    @Operation(summary = "修改摄像头管理", description = "修改摄像头管理")
    public ResultVO<String> update(@RequestBody @Validated CameraMonitoringUpdateDTO dto) {
        return cameraMonitoringService.update(dto);
    }



    @PostMapping("/batchDelete")
    @Operation(summary = "批量删除摄像头管理", description = "批量删除摄像头管理")
    public ResultVO<String> batchDelete(@RequestBody List<String> cameraIds) {
        return cameraMonitoringService.batchDelete(cameraIds);
    }
}
